@{
    ViewBag.Title = "JSON、GET请求字符串互转";
    ViewBag.keywords = "JSON,GET请求字符串互转";
    ViewBag.description = "JSON、GET请求字符串互转";var host = Appsettings.app("BaseFile:HostUrl");
}
<div class="layui-row layui-form layui-form-pane get2Json">
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">内容：</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入内容" id="content" name="content" rows="8" lay-verify="required" autocomplete="off" class="layui-textarea">www.ruovea.com</textarea>
        </div>
    </div>
    <div class="layui-form-item base16">
        <a class="layui-btn jget">JSON转GET请求参数</a>
        <a class="layui-btn layui-btn-normal gjson">GET请求参数转JSON</a>
        <a class="layui-btn layui-btn-danger cle">清空</a>
        <a class="layui-btn layui-btn-primary dem">DEMO</a>
        <a class="layui-btn layui-btn-primary copy">复制结果</a>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">输出：</label>
        <div class="layui-input-block">
            <textarea placeholder="输出内容" id="outtxt" name="outtxt" rows="8" autocomplete="off" class="layui-textarea"></textarea>
        </div>
    </div>
</div>
@section Scripts{
<script type="text/javascript">
     layui.config({ base: '@host/js/' }).use('common',function(){  $=layui.jquery;var Get2Json=layui.Get2Json;let area_input = document.getElementById('content');let area_output = document.getElementById('outtxt');
    $(".get2Json .jget").bind("click", function () {
        var code = area_input.value;
        if (code === undefined || code === '' || code === null) { layer.msg("内容不能为空.", { icon: 2 }); return; }
        area_output.value = Get2Json.Jsonget(area_input, 1);
    });
    $(".get2Json .gjson").bind("click", function () {
        var code = area_input.value;
        if (code === undefined || code === '' || code === null) { layer.msg("内容不能为空.", { icon: 2 }); return; }
        area_output.value = Get2Json.Jsonget(area_input, 2);
    });
    $(".get2Json .dem").bind("click", function () { $("#content").val('{"a":"11","b":"12"}'); });
      });
</script>
}